﻿Option Strict On
Option Explicit On
Public Class clsDBSFCommon
    Public Function GetAllMsg(ByVal lang As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT MESSAGE_ID, MESSAGE"
        szSql &= "  FROM PER.T_MESSAGE_MST "
        szSql &= "  WHERE LANGUAGE = '" & lang & "' "
        szSql &= "  ORDER BY MESSAGE_ID"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If IsNothing(dt) Then
            GetAllMsg = New DataTable
        Else
            GetAllMsg = dt
        End If

    End Function
    Public Function GetFactoryInfo_Num1(ByVal p_param_id As Integer, ByVal default_value As Integer) As Integer
        Dim szSql As String = ""
        szSql &= "Select num_param1 from kad.t_factory_info "
        szSql &= "where param_id = ? "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, p_param_id)
        If IsNothing(dt) Then
            GetFactoryInfo_Num1 = default_value
        Else
            If dt.Rows.Count = 0 Then
                GetFactoryInfo_Num1 = default_value
            Else
                GetFactoryInfo_Num1 = CInt(dt.Rows(0)("num_param1").ToString)
            End If
        End If

    End Function

    Public Function GetFactoryInfo_Str2(ByVal p_param_id As Integer, ByVal default_value As String) As String
        Dim szSql As String = ""
        szSql &= "Select str_param2 from kad.t_factory_info "
        szSql &= "where param_id = ? "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, p_param_id)
        If IsNothing(dt) Then
            GetFactoryInfo_Str2 = default_value
        Else
            If dt.Rows.Count = 0 Then
                GetFactoryInfo_Str2 = default_value
            Else
                GetFactoryInfo_Str2 = dt.Rows(0)("str_param2").ToString
            End If
        End If
    End Function

End Class
